<template>
  <div>
    <mt-header title="宠物详情" fixed style="background: #f49b00">
      <router-link to="" slot="left">
        <mt-button icon="back" @click="$router.go(-1)"></mt-button>
      </router-link>
    </mt-header>
    <div>
      <van-image
        width="100%"
        radius="0px 0px 20px 20px"
        :src="`${petmessage.pic}`"
      />

      <h2 style="margin-left: 15px">{{ petmessage.petName }}</h2>
      <div class="content">
        {{ petmessage.content }}
      </div>
    </div>
  </div>
</template>

<script>
import { Dialog } from "vant";
import { Toast } from "vant";
export default {
  // 局部注册
  components: {
    [Dialog.Component.name]: Dialog.Component,
  },

  props: ["pmid"],
  data() {
    return {
      petmessage: [],
    };
  },
  mounted() {
    this.getdata();
  },
  methods: {
    // 发送请求，获得宠物详情页数据
    getdata() {
      this.axios
        .get(`/petmessage/details?pmid=${this.$route.query.pmid}`)
        .then((res) => {
          console.log(res);
          this.petmessage = res.data.results[0];
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.van-nav-bar {
  background-color: #f49b00;
}
div {
  background-color: #fcfcfc;
}

.content {
  padding: 16px;
  letter-spacing: 5px;
  border: 3px solid #f49b00;
  border-radius: 10px;
  margin: 5px;
}

::v-deep .mint-header-title{
  font-size: 15px;
}
</style>